#include "unitTest.h"

#define TESTCASE_NAME(testcase_name) \
	testcase_name##_TEST

#define NANCY_TEST_(testcase_name) \
class TESTCASE_NAME(testcase_name) : public TestCase \
{ \
public: \
	TESTCASE_NAME(testcase_name)(const char* case_name) : TestCase(case_name){}; \
	virtual void Run(); \
private: \
	static TestCase* const testcase_; \
}; \
	\
	TestCase* const TESTCASE_NAME(testcase_name) \
	::testcase_ = UnitTest::GetInstance()->RegisterTestCase( \
	new TESTCASE_NAME(testcase_name)(#testcase_name)); \
	void TESTCASE_NAME(testcase_name)::Run()

#define NTEST(testcase_name) \
	NANCY_TEST_(testcase_name)

//////////////////////////////////////////////////////////////////////////

#define RUN_ALL_TESTS() \
	UnitTest::GetInstance()->Run();




//////////////////////////////////////////////////////////////////////////
#define EXPECT_EQ(m, n) \
	if (m != n) \
	{ \
	UnitTest::GetInstance()->CurrentTestCase->nTestResult = 0; \
	std::cout << red << "Failed" << std::endl; \
	std::cout << red << "Expect:" << m << std::endl; \
	std::cout << red << "Actual:" << n << std::endl; \
	}